package com.situ.controller;

import com.situ.domain.vo.CategoryVO;
import com.situ.service.CategoryService;
import com.situ.utils.Result;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/category")
@RequiredArgsConstructor
@Tag(name = "分类接口")
public class CategoryController {

    private final CategoryService categoryService;
    @GetMapping("/showCategory")
    @Cacheable(value = "index:category", key = "'showCategory'")
    public Result showCategory() {
        CategoryVO categoryVO = categoryService.showCategory();
        return Result.success(200, "查询成功", categoryVO);
    }
}
